def findMaxConsecutiveOnes(nums):
    one = 0
    res = 0
    for num in nums:
        if num == 1:
            one += 1
        else:
            res = max(one, res)
            one = 0
    return res


nums = [1, 1, 1, 0, 1]
print(findMaxConsecutiveOnes(nums))  # 3
